<?php 

//////////////////////////////////////////////////////
//						Récupération des variables				//
//////////////////////////////////////////////////////

$connectionAdmin = (!empty($_POST['connectAdmin'])) ? $_POST['connectAdmin'] : false;

if ($connectionAdmin) {
	
	$login = (!empty($_POST['login'])) ? $_POST['login'] : false;
	$mdp = (!empty($_POST['mdp'])) ? $_POST['mdp'] : false;
	
	$auth = new Authentification($login, $mdp);
        
	if($auth->getEtatConnexion() == "connecte") {
		
//		session_start();

		$_SESSION['login_session'] = $auth->getIdConnexion();
//                $_SESSION['login_session'] = "toto";
		
		header("Location:index.php?page=accueil");
		
	}
	else{
//            include_once 'structure/en-tete.php';
		include_once 'module_techniciens/vues/vue_connexion_refusee.html';
		
}
}

else {
	unset($login_session);
	session_destroy();
	
	// Arrivée sur la page
	$bouton_haut = array(false,false,false);
	$bouton_bas = array(false,false,false,"authentification");
	$pAffichageResultat = "";
	$pValeurChamp= "";
	
	include_once 'structure/en-tete.php';
	include_once 'structure/vue_menu_superieur.php';
	
	include_once 'module_techniciens/vues/vue_authentification.php';
	
	include_once 'structure/vue_menu_inferieur.php';
	include_once 'structure/pied.php';

}

